package com.weixing.mall.provider.controller.admin;

import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.provider.model.dto.GoodsIntroDto;
import com.weixing.mall.provider.service.IGoodsIntroService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author wx
 * @Date 2019/10/24 11:10
 * @Version 1.0
 */
@RestController
@RequestMapping("goodsIntro")
@Api(value = "商品详情管理API",tags = "商品详情管理")
public class GoodsIntroController {
    @Autowired
    private IGoodsIntroService goodsIntroService;

    @ApiOperation("新增")
    @PostMapping("save")
    public Result save(GoodsIntroDto goodsIntroDto){
        goodsIntroService.save(goodsIntroDto);
        return ResultUtil.success();
    }

    @ApiOperation(value = "查询商品描述详情")
    @PostMapping("selectIntroByGoodsId/{goodsId}")
    public Result selectIntroByGoodsId(@PathVariable Long goodsId){
        return ResultUtil.success(goodsIntroService.selectByGoodsId(goodsId));
    }
}
